<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>评价</title>
    <link href="../../css/common.css" rel="stylesheet"/>
    <link href="../../css/mui.min.css" rel="stylesheet"/>
    <link href="../../css/order/orderDetail.css" rel="stylesheet"/>
    <script src="../../js/vue.min.js"></script>
    <script src="../../js/mui.min.js"></script>
    <script src="../../js/fastclick.js"></script>
    <script src="../../js/vue-common.js"></script>
    <script src="../../js/api.js"></script>
    <script src="../../js/common.js"></script>
    <style>
        .comment-box{
            text-align: center;
        }
        .comment-text{
            color: #F49D4A;
            font-size:1.2rem;
            width: 30%;
            margin-left: 55%;
        }
        .comment-box img{
            margin-left: 0.5rem;
        }
    </style>
</head>
<body>
<div id="app">
    <div class="header-nav">
        <span>评价</span>
        <div class="icon"><img src="../../img/common/btn_back.png" alt=""></div>
    </div>

    <div class="container">

        <div class="card-box">
            <div class="order-title">写评价</div>
            <div>
                <textarea  v-model="form.note" class="text-area"  placeholder="维修结果怎么样？说说看吧~"></textarea>
            </div>
        </div>

        <div class="card-box">
            <div class="order-title">评分</div>
            <xlb-comment  v-model="form.point"></xlb-comment>
        </div>

        <div @click="saveCommon" class="xl-btn normal no-shadow">提交</div>
    </div>
</div>
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            orderId: '',
            form:{
                orderId:'',
                point:0,
                note:''
            },
            test:true

        },
        methods: {
            saveCommon:function () {
                Resource.post(ORDER_ADD_COMMON_API, this.form, function (res) {
                    var form = vm.form;
                    // 获取窗口对象
                    ws = plus.webview.currentWebview();
                    wo = ws.opener();
                    console.log("dealAddCommon(" + form.point + ",'" + form.note + "');");
                    wo.evalJS("dealAddCommon(" +form.point + ",'"+form.note+"');");
                    mui.back();
                })
            }
        }
    });

</script>
<script>
    mui.plusReady(function () {
        var self = plus.webview.currentWebview();
        var orderId =  self.orderId;
        if(orderId =='' || orderId == 'undefined'){
            return;
        }
        console.log('listen ----------orderId =' + orderId);
        vm.orderId = orderId;
        vm.form.orderId = orderId;

    });
</script>
</body>
</html>